#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: gc_circle_quote.py 
@version:
@time: 2023/04/21 
"""
import gc
import os
import psutil


def show_memory_info(hint):
    pid = os.getpid()
    p = psutil.Process(pid)

    info = p.memory_full_info()
    memory = info.uss / 1024. / 1024
    print(f"{hint} use memory：{memory} MB")


def func():
    show_memory_info('initial')
    a = [i for i in range(10000000)]
    b = [i for i in range(10000000)]
    show_memory_info('after a, b created')
    a.append(b)
    b.append(a)


func()
gc.collect()
show_memory_info('finished')
